﻿Imports System.Configuration
Imports System.Web.Configuration


Namespace Configuration

    Public Class AnswerElement
        Inherits ConfigurationElement

        <ConfigurationProperty("Name", IsKey:=True, IsRequired:=True)> _
        Public Property Name() As String
            Get
                Return DirectCast(Me("Name"), String)
            End Get
            Set(ByVal value As String)
                Me("Name") = value
            End Set
        End Property

        <ConfigurationProperty("Value", IsRequired:=False)> _
        Public Property Value() As String
            Get
                Return DirectCast(Me("Value"), String)
            End Get
            Set(ByVal value As String)
                Me("Value") = value
            End Set
        End Property

    End Class

    <ConfigurationCollection(GetType(AnswerElement))> _
    Public Class AnswerCollection
        Inherits ConfigurationElementCollection

        Protected Overloads Overrides Function CreateNewElement() As ConfigurationElement
            Return New AnswerElement()
        End Function

        Protected Overloads Overrides Function GetElementKey(ByVal element As ConfigurationElement) As Object
            Return DirectCast((element), AnswerElement).Name
        End Function

        Default Public Shadows ReadOnly Property Item(ByVal idx As Integer) As AnswerElement
            Get
                Return DirectCast(BaseGet(idx), AnswerElement)
            End Get
        End Property

    End Class

End Namespace